<?php echo $this->Form->create('Paginate', array('id' => 'paginate', 'url' => $this->request->here(false), 'type' => 'post', 'inputDefaults' => array('label' => false))); ?>                           
<div id="content-header">
    <h1><?php echo __d('system','Config Mail Management');?></h1>
    <?php   echo $this->element('toolbar');?> 
</div>
<div class="container-fluid">
<div class="row-fluid">
    <div class="span12">    
        <div class="widget-box widget-content-no-padding">
            <!--For manage node normal-->
            <div class="widget-content widget-content-two">
            <?php   echo $this->Session->flash();?>    
                <table class="table table-bordered data-table table-striped wd-hover-btn">
                    <thead>
                        <tr>                            
                            <th style="min-width: 400px"> <?php echo  __d('system', 'Subject'); ?></th>
                            <th> <?php echo  __d('system', 'UserName'); ?></th>
                            <th> <?php echo  __d('system', 'Site Name'); ?></th>                                                
                            <th class="wd-fix-width-2" style="min-width: 200px;"><?php echo  __d('system', 'Action'); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                            $defaultLanguage = Router::defaultLanguage();
                            $_queries = array('continue' => $this->request->here(false));
                        ?> 
                        <?php foreach ($mails as $mail) :?>                                            
                            <tr>                                
                                <td>
                                    <a href="<?php echo $this->Html->url(array('plugin'=>'node','controller' => 'node', 'action' => 'edit_config_mail',$mail['ConfigMail']['id'], '?' => $_queries));?>"> <?php echo $mail['ConfigMail']['subject']; ?></a>
                                </td>                                                                                                                                         
                                <td>
                                    <a href="#"><?php echo $mail['ConfigMail']['username']; ?></a>
                                </td>                                                                                         
                                <td>
                                    <?php echo $mail['ConfigMail']['sub_site_name'];?>
                                </td>                        
                                <td>
                                    <ul class="wd-link-control">
                                        <?php if($mail['ConfigMail']['set_default']!=1):?>
                                            <li><a href="<?php echo $this->Html->url(array('plugin'=>'node','controller' => 'node', 'action' => 'set_default_mail',$mail['ConfigMail']['id'],$mail['ConfigMail']['sub_site_id'],'?' => $_queries));?>" class="btn btn-mini"><i class="icon-edit"></i> <?php echo __d('system','Set Default');?></a></li>
                                        <?php else:?>
                                             <li><a disabled="disabled" onclick="return false;" href="#" class="btn btn-mini"><i class="icon-edit"></i> <?php echo __d('system','Set Default');?></a></li>
                                        <?php endif; ?>
                                        <li><a href="<?php echo $this->Html->url(array('plugin'=>'node','controller' => 'node', 'action' => 'edit_config_mail',$mail['ConfigMail']['id'], '?' => $_queries));?>" class="btn btn-mini"><i class="icon-edit"></i> <?php echo __d('system','Edit');?></a></li>
                                        <?php if($mail['ConfigMail']['set_default']!=1):?>
                                            <li><a href="#<?php echo $mail['ConfigMail']['id']?>" data-toggle="modal" class="btn btn-mini"><i class="icon-remove"></i> <?php echo __d('system','Delete');?></a></li>
                                        <?php else:?>
                                            <li><a href="#" disabled="disabled" data-toggle="modal" class="btn btn-mini"><i class="icon-remove"></i> <?php echo __d('system','Delete');?></a></li>                                        
                                        <?php endif;?>
                                    </ul>
                                </td>
                            </tr>                                                                                 
                            <?php endforeach?>                        
                    </tbody>                                       
                <?php foreach ($mails as $mail) : ?> 
                     <div id="<?php echo $mail['ConfigMail']['id']?>" class="modal hide">
                        <div class="modal-header">
                            <button data-dismiss="modal" class="close" type="button">×</button>
                            <h3><?php echo __d('system','Alert modal');?></h3>
                        </div>
                        <div class="modal-body">
                            <p><?php echo __d('system','Are you sure delete');?> “<?php echo $mail['ConfigMail']['subject']?>”?</p>
                        </div>
                        <div class="modal-footer">
                            <a data-dismiss="modal" class="btn" href="#"><?php echo __d('system','Cancel');?></a>
                            <?php echo $this->Html->link(__d('system','Delete'), array('plugin'=>'node','controller' => 'node','action' => 'delete_multiple', '?' => array_merge($_queries, array('keys' => array($mail['ConfigMail']['id']),'model'=>'ConfigMail','linkAction'=>'manage_config_mail'))), array('title' => false, 'class' => 'btn btn-danger','data-dismiss='=>'modal')); ?>                        
                        </div>
                    </div>  
                <?php endforeach?>
                </table>
            </div>
        </div>
    </div>    
</div>
<?php         
    echo $this->Form->hidden('task', array('id' => 'task', 'value' => ''));
    echo $this->Form->end();
?>